import java.io.File;

import javax.xml.bind.annotation.XmlRootElement;

import codeg.CodeGeneration;
import codeg.CodeGenerationContext;
import codeg.Codeg;
import codeg.CodegException;


@XmlRootElement
public class ImageCodeg extends Codeg {
    private File path = null;

    public ImageCodeg() {}

    public void setPath(File path) {
        this.path = path;
    }

    public File getPath() {
        return path;
    }

    @Override
    public CodeGeneration getCode(CodeGenerationContext context)
        throws CodegException {
        CodeGeneration code = new CodeGeneration(this);

        /* This codeg only generates Java code currently */
        if (context.getLanguage() != CodeGenerationContext.LANGUAGE.JAVA)
            return code;
        
        if (path == null) code.setLocalCode("");
        else code.setLocalCode("\"" + getPath().toString() + "\"");
        
        return code;
    }
}